/**
  * ?form?????????????cookies????????
  * ??????????????????????
  * ????? 2006-5-17
  */

function setCookie(name,value)
{
    var Days = 90;
    var exp  = new Date();    //new Date("December 31, 9998");
        exp.setTime(exp.getTime() + Days*24*60*60*1000);
        document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg)) return unescape(arr[2]);
        else return null;
}
function delCookie(name)
{
    var exp = new Date();
        exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
        if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

function saveLoginInfo(arr){
//?????????????????,??????
	//alert(arr);
	var i;
	var str;
	str="";
	if(arr.length<1)return;
	str=arr[0];
	for(i=1;i<arr.length;i++)
		str+=","+arr[i];
	//alert(str);
	setCookie("LoginInfo",str);
}

function loadLoginInfo(){
//?cookies?????????????????form??
	var str;
	var arr;
	var obj;
	var i,j;
	str=getCookie("LoginInfo");
	if(str==null)return;
	arr=str.split(",");
	if(arr.length<1)return;
	//alert(arr);
	for(i=0;i<arr.length;i+=2){
		obj=document.getElementsByName(arr[i]);
		for(j=0;j<obj.length;j++){
			if(obj[j].tagName=="INPUT"){
				obj[j].value=arr[i+1];
				break;
			}
		}
	}
}